<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends CommonAction {

    public function index(){
		$this->display();
    }

	public function nav(){
		$this->display();
	}

	public function admin_info(){
		$this->assign('username',$_SESSION['username']);
		$this->display();
	}

	public function doadmin_info(){
		$password = $this->_isempty($_POST['password'],'原密码不能为空');
		$newpassword1 = $this->_isempty($_POST['newpassword1'],'新密码不能为空');
		$newpassword2 = $_POST['newpassword2'];
		if($newpassword1 != $newpassword2){
			$this->error('两新密码不相同');
		}

		$id = $_SESSION['adminid'];
		$m = M('admin');
		$list = $m->find($id);

		if($list['password'] != encrypt($_POST['password'])){
			$this->error('原密码错误');
		}else{
			$map['id'] = $_SESSION['adminid'];
			$map['password'] = encrypt($newpassword1);

			if($m->save($map)){
				$this->assign('jumpUrl',__APP__.'/Admin/login/');
				$this->assign('waitSecond','1');
				$this->success("修改成功");
			}

		}



	}







}